Skip to content

interpreters/berry: Normalize CRLF before patching#3567

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
speccy88:codex/fix-berry-crlf-before-patch
Jun 30, 2026
Merged

interpreters/berry: Normalize CRLF before patching#3567
xiaoxiang781216 merged 1 commit into
apache:masterfrom
speccy88:codex/fix-berry-crlf-before-patch

Conversation

@speccy88

Copy link
Copy Markdown
Contributor

Berry upstream stores default/berry.c with CRLF line endings, while the local NuttX patch is LF. Fresh Make and CMake builds can therefore fail before Berry is compiled because GNU patch rejects the hunks as line-ending mismatches.

Normalize the downloaded Berry default/berry.c before applying the existing NuttX patch in both Make and CMake fetch paths.

Tested:

  • Fresh Berry archive: fix-crlf.py + patch -l -p1 applies and updates OS_NAME / optvalue.
  • ./tools/configure.sh -a ../apps sim:berry && make olddefconfig && make -j8
  • Simulator smoke: berry -v prints Berry 1.1.0; berry -e print(40+2) prints 42.
  • ./tools/testbuild.sh -m -C -N -x -j 8 -a ../apps -t /tmp/nuttx_current_berry /tmp/berry-cmake-testlist.dat
  • tools/checkpatch.sh -c -u -m -g origin/master..HEAD
  • ESP32-C3 hardware smoke on /dev/cu.usbmodem101: flashed esp32c3-devkit:usbconsole with Berry enabled; berry -v prints Berry 1.1.0; berry -e print(40+2) prints 42.

Signed-off-by: Frederick Blais fred_blais5@hotmail.com

@simbit18

Copy link
Copy Markdown
Contributor

Hi @xiaoxiang781216, Is this related to any recent changes?

====================================================================================
Configuration/Tool: pic32mx7mmb/nsh,CONFIG_MIPS32_TOOLCHAIN_PINGUINOL
2026-06-28 16:44:34
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_MIPS32_TOOLCHAIN_GNU_ELF
  Enabling CONFIG_MIPS32_TOOLCHAIN_PINGUINOL
  Building NuttX...
usbmsc_main.c: In function 'msconn_main':
Error: usbmsc_main.c:584:51: error: 'O_WROK' undeclared (first use in this function)
                            luns[num_luns].flags & O_WROK ? false : true);
                                                   ^
usbmsc_main.c:584:51: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [/github/workspace/sources/apps/Application.mk:330: usbmsc_main.c.github.workspace.sources.apps.system.usbmsc.o] Error 1
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile:54: /github/workspace/sources/apps/system/usbmsc_all] Error 2
make[1]: Target 'all' not remade because of errors.
make: *** [tools/LibTargets.mk:248: /github/workspace/sources/apps/libapps.a] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 397: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  [1/1] Normalize pic32mx7mmb/nsh
/github/workspace/sources/nuttx /github/workspace/sources/nuttx
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
/github/workspace/sources/nuttx
/github/workspace/sources/apps /github/workspace/sources/nuttx
HEAD detached at pull/3567/merge
nothing to commit, working tree clean
/github/workspace/sources/nuttx
Build Attempt 1 of 1
====================================================================================

@acassis

acassis commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

@xiaoxiang781216 there are two places where the old symbol still used:

alan@dev:~/nuttxspace/apps$ git grep O_WROK
examples/userfs/userfs_main.c:      if ((oflags & (O_WROK | O_APPEND)) == (O_WROK | O_APPEND))
system/usbmsc/usbmsc_main.c:                           luns[num_luns].flags & O_WROK ? false : true);

Comment thread interpreters/berry/Makefile Outdated
@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@xiaoxiang781216 there are two places where the old symbol still used:

alan@dev:~/nuttxspace/apps$ git grep O_WROK
examples/userfs/userfs_main.c:      if ((oflags & (O_WROK | O_APPEND)) == (O_WROK | O_APPEND))
system/usbmsc/usbmsc_main.c:                           luns[num_luns].flags & O_WROK ? false : true);

here is the fix: #3568

Berry's downloaded default/berry.c uses CRLF line endings, while the local NuttX patch was LF. Fresh Linux and CMake builds failed when patch saw the line-ending mismatch.

Regenerate the local Berry patch against the pinned upstream CRLF source and apply it directly in both Make and CMake fetch paths. This keeps the integration working until the Berry-side change is merged upstream and the pinned commit can be updated.

Signed-off-by: Frederick Blais <fred_blais5@hotmail.com>
@speccy88 speccy88 force-pushed the codex/fix-berry-crlf-before-patch branch from 1218d36 to 30cdb19 Compare June 30, 2026 11:22

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @speccy88 :-) Lets just make sure CI completes fine :-)

@acassis

acassis commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@speccy88 do you think this .patch could be submitted to Berry mainline later? I didn't dive on it, but seems like some NuttX structures are different from Linux/Unix, right?

@xiaoxiang781216 xiaoxiang781216 merged commit fc25af7 into apache:master Jun 30, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants